package com.jinghua.treatment.service.impl;

import com.jinghua.treatment.entity.SysDoctorNoticeSetting;
import com.jinghua.treatment.entity.SysDoctorNoticeSettingExample;
import com.jinghua.treatment.mapper.SysDoctorNoticeSettingMapper;
import com.jinghua.treatment.service.SysNoticeSettingService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * Created by 王兴光 on 2018/3/30.
 */
@Service
public class SysNoticeSettingServiceImpl implements SysNoticeSettingService {

    @Resource
    private SysDoctorNoticeSettingMapper noticeSettingMapper;
    @Override
    @Transactional
    public int insert(SysDoctorNoticeSetting record) {
        return noticeSettingMapper.insert(record);
    }

    @Override
    public SysDoctorNoticeSetting selectByDoctorId(Integer doctorId){
        SysDoctorNoticeSettingExample example = new SysDoctorNoticeSettingExample();
        example.getOredCriteria().add(example.createCriteria().andDoctorIdEqualTo(doctorId));
        return noticeSettingMapper.selectByExample(example).get(0);
    }


    @Override
    @Transactional
    public int updateByPrimaryKey(SysDoctorNoticeSetting record) {
        return noticeSettingMapper.updateByPrimaryKey(record);
    }
}
